Handle record type 100 in TomTom v7.540.
authorrobertl <robertl>
Wed, 18 Jun 2008 04:04:05 +0000 (04:04 +0000)
committerrobertl <robertl>
Wed, 18 Jun 2008 04:04:05 +0000 (04:04 +0000)
tomtom.c

index a85de57ba80a9ba2e390b190a087995ec3e76967..498ac34c6148b03b49d1f9b87d397b1910cfa2d1 100644 (file)
--- a/tomtom.c
+++ b/tomtom.c
@@ -88,7 +88,18 @@ data_read(void)
        waypoint *wpt_tmp;
        while (!gbfeof( file_in ) ) {
                rectype = read_char( file_in );
-               if ( rectype == 1 ) {
+               if (global_opts.debug_level >= 5)
+                       printf("Reading record type %d\n", rectype );
+               if ( rectype == 0 || rectype == 100 ) {
+                       if (global_opts.debug_level >= 5)
+                               printf("Skipping deleted record\n" );
+                       recsize = read_long( file_in ) - 5;
+                       if (global_opts.debug_level >= 5)
+                               printf("Skipping %li bytes\n", recsize );
+                       while (recsize-- > 0)
+                               read_char( file_in );
+               }
+               else if ( rectype == 1 ) {
                        /* a block header; ignored on read */
                        read_long( file_in );
                        read_long( file_in );
@@ -108,9 +119,18 @@ data_read(void)
                        wpt_tmp->longitude = x/100000.0;
                        wpt_tmp->latitude = y/100000.0;
                        wpt_tmp->description = desc;
+                       // TODO:: description in rectype 3 contains two zero-terminated strings
+                       // First is same as rectype 2, second apparently contains the unique ID of the waypoint
+                       // See http://www.tomtom.com/lib/doc/PRO/TTN6_SDK_documentation.zip
+                       if ( rectype == 3) {
+                               warning("Unexpected waypoint record type %d encountered.\nThe unique ID of the POI may have been dropped.\n", rectype );
+                       }
 
                        waypt_add(wpt_tmp);
                }
+               else if (global_opts.debug_level >= 1) {
+                       warning("Unexpected waypoint record type: %d \n", rectype );
+               }
        }
 }